//
//  TypeControlView.m
//  兼职页面
//
//  Created by kuiyuan liang on 2021/5/28.
//

#import "TypeControlView.h"
#import "CommonUtil.h"


@interface TypeControlView()
@property (strong, nonatomic) UIImageView * iconImageView;
@property (strong, nonatomic) UILabel * label;
@end

@implementation TypeControlView

-(instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {

        [self addSubview:self.iconImageView];
        [self addSubview:self.label];
    }
    return self;
}


-(void)setType:(NSString *)type{
    _type = type;
    self.label.text = type;
    if ([type isEqualToString:@"港彩"]) {
        self.iconImageView.image = [UIImage imageNamed:@"icon_home_gangcai"];
    }else if ([type isEqualToString:@"澳彩"]){
        self.iconImageView.image = [UIImage imageNamed:@"icon_home_aocai"];
    }
}


-(UIImageView *)iconImageView{
    if (!_iconImageView) {
        _iconImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"statistics_default.jpg"]];
        CGFloat w = AD(45);
        _iconImageView.frame = CGRectMake(0,AD(10), w, w);
        _iconImageView.layer.cornerRadius = w/2;
        _iconImageView.clipsToBounds = YES;
        _iconImageView.centerX = self.width/2;
    }
    return _iconImageView;
}

-(UILabel *)label{
    if (!_label) {
        _label = [[UILabel alloc] initWithFrame:CGRectMake(0, _iconImageView.bottom + AD(8) , self.width, AD(25))];
        _label.font = [UIFont systemFontOfSize:AD(17)];
        _label.textColor = [UIColor blackColor];
        _label.text = @"吴妍珠";
        _label.textAlignment = NSTextAlignmentCenter;
    }
    return _label;
}
@end
